<?php
/*
	uc账号互通配置
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$return['item']=core_setting('uc');
	if(!is_array($return['item'])){
		$return['item']=array();
	}
	$htmls=array(
		'type'=>'edit',
		'post'=>'post',
		'edit_tab'=>true,
		'edits'=>array(
			array('title'=>'UC对接参数','list'=>array(
				array('type'=>'switch','title'=>'开启UC账号互通','name'=>'status','help'=>''),
				array('type'=>'string','title'=>'UC数据库地址','name'=>'db_host','help'=>'一般和论坛数据库参数一致'),
				array('type'=>'string','title'=>'UC数据库账号','name'=>'db_user','help'=>''),
				array('type'=>'password','title'=>'UC数据库密码','name'=>'db_passwd','help'=>''),
				array('type'=>'string','title'=>'UC数据库名称','name'=>'db_name','help'=>''),
				array('type'=>'string','title'=>'UC数据库编码','name'=>'db_charset','help'=>''),
				array('type'=>'string','title'=>'UC数据表前缀','name'=>'db_pre','help'=>'表前缀一般和论坛数据表不一样，需注意，例如：pre_ucenter_'),
				array('type'=>'string','title'=>'论坛数据表前缀','name'=>'bbs_pre','help'=>'用于同步发帖，例如：pre_'),
				array('type'=>'string','title'=>'UC应用ID','name'=>'api_appid','help'=>'论坛UCenter创建应用获取应用ID个密钥。创建应用时，应用主URL填写“'.SITEROOT.'api”'),
				array('type'=>'string','title'=>'UC应用密钥','name'=>'api_key','help'=>''),
			)),
			array('title'=>'论坛发帖同步','list'=>array(
				array('type'=>'switch','title'=>'开启同步','name'=>'up_status','help'=>'是否同步系统文章到论坛'),
				array('type'=>'string','title'=>'文章论坛板块ID','name'=>'up_cid','help'=>'填写同步文章到指定的论坛板块ID'),
				array('type'=>'string','title'=>'产品论坛板块ID','name'=>'up_gid','help'=>'填写同步产品到指定的论坛板块ID'),
				array('type'=>'string','title'=>'发帖身份UID','name'=>'up_uid','help'=>'发帖人身份ID'),
				array('type'=>'string','title'=>'发帖人账号','name'=>'up_name','help'=>'发帖人论坛账号'),
			)),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$postdata['status']=intval($postdata['status']);
	$postdata['up_status']=intval($postdata['up_status']);
	core_setting('uc',$postdata);
	exi('设置成功！');
}
